package com.zbkj.service.model.front.vo.order;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zbkj.dal.common.BigDecimalSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

@Data
@ApiModel
public class LeaseOrderProlongCalculateVO {

    @ApiModelProperty(value = "商品总金额", example = "1000.00")
    @JsonSerialize(using = BigDecimalSerializer.ConvertToString.class)
    private BigDecimal totalAmount;

    @ApiModelProperty(value = "超时费用", example = "200.00")
    @JsonSerialize(using = BigDecimalSerializer.ConvertToString.class)
    private BigDecimal timeoutFee;

    @ApiModelProperty(value = "承享到期雅识(自动)抵扣金额", example = "100.00")
    @JsonSerialize(using = BigDecimalSerializer.ConvertToString.class)
    private BigDecimal deductionsAuto;

    @ApiModelProperty(value = "雅识抵扣金额", example = "100.00")
    @JsonSerialize(using = BigDecimalSerializer.ConvertToString.class)
    private BigDecimal deductions;

    @ApiModelProperty(value = "支付金额", example = "1100.00")
    @JsonSerialize(using = BigDecimalSerializer.ConvertToString.class)
    private BigDecimal payAmount;

    // -------- 默认为0 --------

    @ApiModelProperty(value = "运费", example = "0.00")
    @JsonSerialize(using = BigDecimalSerializer.ConvertToString.class)
    private BigDecimal freight;

    public BigDecimal calculationPayAmount() {
        // 商品总金额 + 超时费用 + 运费 - 雅识抵扣金额 - 历史雅识抵扣金额
        return totalAmount.add(timeoutFee).add(freight).subtract(deductions).subtract(deductionsAuto);
    }
}
